<?php
/*
 * Only get messages either to oneself, from oneself, or to everyone
 */
class SelfOnly implements iFilter
{
	public function applyFilter($echo)
	{
		if(!( #so if none of these conditions are true, fail
			$echo['nickname'] == $echo['selfnick'] || #message is from self
			$echo['replyto'] == ">>" . $echo['selfnick'] || #message is directed to self
				(
					!$echo['replyto'] && #the echo isn't for anyone specifically
					$echo['nickname'] != $echo['selfnick'] #and it's not from self (someone else -> all)
				)
			)
		)
		{
			return false;
		}
		else
		{
			return $echo;
		}
	}
}
?>
